package com.example.group.network.express_plus_app.data.model;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import org.jetbrains.annotations.NotNull;

/**
 * Data class that captures user information for logged in users retrieved from LoginRepository
 */
@Entity(tableName = "user")
public class LoggedInUser {

    @PrimaryKey
    @ColumnInfo(name = "phone")
    @NotNull
    private String phone;
    @ColumnInfo(name = "display_name")
    private String displayName;//网名
    @ColumnInfo(name = "access_token")
    private String accessToken;
    @ColumnInfo(name = "image_path")
    private String imagePath;
    @ColumnInfo(name = "delivery_address")
    private String deliveryAddress;

    @Override
    public String toString() {
        return "LoggedInUser{" +
                "phone='" + phone + '\'' +
                ", displayName='" + displayName + '\'' +
                ", accessToken='" + accessToken + '\'' +
                ", imagePath='" + imagePath + '\'' +
                ", deliveryAddress='" + deliveryAddress + '\'' +
                '}';
    }

    public String getDeliveryAddress() {
        return deliveryAddress;
    }

    public void setDeliveryAddress(String deliveryAddress) {
        this.deliveryAddress = deliveryAddress;
    }

    public LoggedInUser(@NotNull String phone, String displayName, String accessToken, String imagePath, String deliveryAddress) {
        this.phone = phone;
        this.displayName = displayName;
        this.accessToken = accessToken;
        this.imagePath = imagePath;
        this.deliveryAddress=deliveryAddress;
    }
    @Ignore
    public LoggedInUser(@NotNull String phone) {
        this.phone = phone;

    }

    @NotNull
    public String getPhone() {
        return phone;
    }

    public void setPhone(@NotNull String phone) {
        this.phone = phone;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }
}